﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Common.Model;
using Common.DataAccess;

namespace Common.ServiceLogic
{
    public class GenericReportServiceLogic<V, C, DA> : IGenericReportServiceLogic<V, C>
        where V : ViewEntity
        where C : CriteriaEntity
        where DA : IGenericReportDataAccess<V, C>, new()
    {

        #region IGenericReportServiceLogic<V, C> Members

        DA _dataAccess;
        public DA DataAccess
        {
            get
            {
                if (_dataAccess == null)
                {
                    _dataAccess = new DA();
                }
                return _dataAccess;
            }
        }

        public virtual List<V> ReadViews()
        {
            return DataAccess.ReadViews();
        }

        public virtual List<V> ReadViewsByCriteria(C criteria)
        {
            return DataAccess.ReadViewsByCriteria(criteria);
        }

        #endregion
    }
}
